<template>
	<div>
		<span @click="decrease" :class="{unused:count > 2}">-</span>
		<span v-text="count"></span>
		<span @click="increase" :class="{unused:count > 4}">+</span>
	</div>
</template>

<script type="text/ecmascript-6">
    export default {
        props:{
            count:{required:true,type:Number}
        },
	    methods:{
            increase(){//增加
				if(this.count<5){
					this.$emit("increase")//自定义事件
				}
            },
		    decrease(){//减少
                if(this.count>1){
                    this.$emit("decrease")//自定义事件
                }
		    }
	    }
    };
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>

</style>